<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>FormLayout 表单布局</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    
    <script src="__PUBLIC__/scripts/boot.js" type="text/javascript"></script>
    
    
    <style type="text/css">
        
       
    </style>

</head>
<body>
    <h1>修改用户资料</h1>      
    
<div id="form1">  

<table class="form-table" border="0" cellpadding="1" cellspacing="2">
    <tr>
        <td class="form-label" style="width:60px;">用户名：</td>
        <td style="width:100px">
            <input name="username" class="mini-textbox" readonly="true" allowInput="false" />
        </td>
    </tr>
    <tr>
        <td class="form-label" style="width:60px;">姓名：</td>
        <td style="width:100px">
            <input name="nickname" class="mini-textbox" readonly="true" readonly="true"/>
        </td>
    </tr>
        <tr>
        <td class="form-label">部门：</td>
        <td >
           <input name="depart"  class="mini-textbox" id="depart" readonly="true"/>         
        </td>
    </tr>
     <tr>
        <td class="form-label">职务说明：</td>
        <td >
        	<input name="position" class="mini-textbox" />
        </td>
    </tr>
    <tr>
        <td class="form-label">密码：</td>
        <td >
            <input name="password" class="mini-textbox" />
        </td>
    </tr>
	<tr>
	<td>
         <input value="更新" type="button" onclick="updateForm()" />
	</td>
	</tr>
</table>
</div>
    
    <div class="description">
        <h3>修改姓名及用户名请联系系统管理员</h3>
        <p>            
        </p>
    </div> 
    
    <script type="text/javascript">
        mini.parse();
        loadForm();
        
      function updateForm() {
			//提交表单数据
            var form = new mini.Form("#form1");            
            var data = form.getData(true);      //获取表单多个控件的数据
            //var json = mini.encode(data);   //序列化成JSON
            $.ajax({
                url: "__APP__/User/update",
                type: "post",
                data: { Data: data },
                success: function (text) {
                    alert("提交成功");
                }
            });

        }
	function loadForm() {
            //加载表单数据
            var form = new mini.Form("#form1");            
            $.ajax({
                url: "__APP__/User/loaduserinfo",
                type: "post",
                success: function (text) {
					var data = mini.decode(text);
					
                       //反序列化成对象
                    form.setData(data);             //设置多个控件数据
                }
            });
        }
        
        function getForm() {
			//提交表单数据
            var form = new mini.Form("#form1");  
            form.validate();
            if (form.isValid() == false) return;
			
            var data = form.getData();      //获取表单多个控件的数据
            var json = mini.encode(data);   //序列化成JSON
			mini.alert(json);
        }
        function CloseWindow(action) {

        if (window.CloseOwnerWindow) window.CloseOwnerWindow(action);

        else window.close();

    	} 
        
    </script>

</body>
</html>